bp=function(g){         #定义一个函数g，函数为{}里的内容
  df=data.frame(gene=g,stage=group_list)
  p <- ggpubr::ggboxplot(df, x = "stage", y = "gene",
                 color = "stage", palette = "jco",
                 add = "jitter")
  #  Add p-value
  p + ggpubr::stat_compare_means()
}

# createLink for GeneCards ------------------------------------------------
geneCardsLink <- function(val,name) {
  sprintf('<a href="https://www.genecards.org/cgi-bin/carddisp.pl?gene=%s" target="_blank" class="btn btn-primary">%s</a>',val,name)
}

# createLink for GPL ------------------------------------------------------
gplLink <- function(val,gpl) {
  sprintf('<a href="https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=%s" target="_blank" class="btn btn-primary">%s</a>',val,gpl)
}

# createLink for NCBI -----------------------------------------------------
ncbiLink <- function(val,ncbi) {
  sprintf('<a href="https://www.ncbi.nlm.nih.gov/gene/?term=%s" target="_blank" class="btn btn-primary">%s</a>',val,ncbi)
}

# createLink for Esemble --------------------------------------------------
ensemblLink <- function(val,ensembl) {
  sprintf('<a href="https://www.ensembl.org/Homo_sapiens/Gene/Summary?db=core;g=%s" target="_blank" class="btn btn-primary">%s</a>',val,ensembl)
}

# enrich result list to df
list2df <- function(inputList) {
  # ldf <- lapply(1:length(inputList), function(i) {
  ldf <- lapply(seq_len(length(inputList)), function(i) {
    data.frame(categoryID=rep(names(inputList[i]),
                              length(inputList[[i]])),
               Gene=inputList[[i]])
  })

  do.call('rbind', ldf)
}
